package com.yaiys.thread;

import com.yaiys.jvm.QueueTask;

import java.util.concurrent.CountDownLatch;

public class CountDownLaunchTest {
    public static void main(String[] args) throws InterruptedException {
        long now= System.currentTimeMillis();
        CountDownLatch countDownLatch=new CountDownLatch(2);
        new Thread(new QueueTask(countDownLatch,"取药",5000)).start();
        new Thread(new QueueTask(countDownLatch,"洗车",10000)).start();
        new Thread(new QueueTask(countDownLatch,"买保险",3000)).start();
        countDownLatch.await();
        System.out.println("总算干完了,总共耗时"+(System.currentTimeMillis()-now));
    }
}
